<?php
// +----------------------------------------------------------------------
// | WoShiMaiJia Projcet 
// +----------------------------------------------------------------------
// | Copyright (c) 2010-2011 http://woshimaijia.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: xinqiyang <xinqiyang@gmail.com>
// +----------------------------------------------------------------------

class StoreLogic extends BaseService
{
	
	public static function webPageIndex($params)
	{
		$key = "l:product_recommend";
		$pageSize = empty($params['p']) ? 20 : $params['p'];
		$from = empty($params['f']) ? 0 : $params['f'];
		//product type
		$type = empty($params['t']) ? 0 : $params['t'];
		//get product ids 
		$idList = self::redisGetList($key, $from,$pageSize);
		//get id list of some
		$products = self::redisGetHashes($idList);
		$arr['products'] = !empty($products) ? $products : array();
		//$arr['users'] = !empty($products) ? self::redisGetHashes(strin($products,'user_id')) : array();
		return $arr;
	}
	
	
	
	public static function actSetRecommendProduct($ids)
	{
		$key = "l:product_recommend";
		if(!empty($ids)){
			return self::redisSetList($key, $ids);
		}
		return false;
	}
	
	
	public static function actSetRecommendBrand($ids)
	{
		$key = "l:brand_recommend";
		if(!empty($ids)){
			return self::redisSetList($key, $ids);
		}
		return false;
	}
	
	
}